package com.shelpe.services.tenant.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.shelpe.services.tenant.dto.DictionaryDto;
import com.shelpe.services.tenant.service.DictionaryService;
import com.shelpe.services.tenant.util.DicWord;


@RestController
@RequestMapping(value="/jobserver")
public class DictionaryController {

	private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
	
	@Autowired
	private DictionaryService dicService;
	
	@RequestMapping("/dictionary")
	@ResponseBody
	public DictionaryDto addNewWord(@RequestParam("word") String word, @RequestParam("pos") String pos, @RequestParam("freq") Integer freq){
		
		DictionaryDto dto = new DictionaryDto();
		DicWord dic = new DicWord();
		dic.setWord(word);
		dic.setPos(pos);
		dic.setFreq(freq);
		dicService.insertWord(dic);
		dto.setMessage("success");
		
		return dto;
	}
	
}
